<template>
  <div class="page">
    <!-- 顶部栏 -->
    <Base-Navbar title="登录"></Base-Navbar>

    <div class="container"></div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { useStore } from '@/store/index'
import api from 'js/api'

const router = useRouter()
const route = useRoute()
const store = useStore()

login()

// 登录
async function login() {
  // const params = {
  //   wallet: window.fromAddress,
  // }

  // const { code, data } = await api.login(params)

  const code = 1

  const data = {
    userinfo: {
      id: 3,
      username: 'xiaosu',
      nickname: 'xiaosu',
      mobile: '13112345670',
      avatar:
        '',
      score: 0,
      token: '3f3fc3eb-6340-440f-8a74-d9593a96a765',
      user_id: 3,
      createtime: 1701757560,
      expiretime: 1704349560,
      expires_in: 2592000,
    },
  }

  if (code === 1) {
    store.setUserInfo(data.userinfo)
    router.replace('/')
  }
}
</script>

<style lang="scss" scoped></style>
